package com.woniu.web.feign.interceptor;


import com.woniu.core.util.WebUtil;
import feign.RequestInterceptor;
import org.springframework.stereotype.Component;

@Component
public class TokenInterceptor implements RequestInterceptor {


    //用服务之后的token传递
    @Override
    public void apply(feign.RequestTemplate requestTemplate) {
        String token = WebUtil.getRequest().getHeader("token");
        if(token != null) {
            requestTemplate.header("token", token);
        }
    }
}